home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / GMSV03B.lha / GamesMaster / Source / E / ScreenDemos / WideScroll.e < prev    next >
Encoding:
Text File  |  1996-09-12  |  2.3 KB  |  66 lines

  1. /* Horizontal Scroll 640
  2. ** ---------------------
  3. ** This opens an extra wide screen of 256x640 pixels, and hardware scrolls
  4. ** left and right.  This is *totally* inadequate for platformers, shoot'em-ups
  5. ** etc because the picture size takes up huge amounts of memory.  However for
  6. ** games like Skidmarks, Lemmings, Monkey Island, etc, such large screens can
  7. ** be a necessity.
  8. */
  9.  
  10. MODULE 'games','games/games'
  11.  
  12. PROC main()
  13.    DEF screen:PTR TO gamescreen, palette:PTR TO INT, direction=1:LONG,
  14.        loadpic:PTR TO picture
  15.  
  16.    palette := [ $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801,
  17.         $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880
  18.           ]:INT;
  19.  
  20.    screen :=  [    GSV1,0,
  21.         0,0,0,                -> Screen_Mem1/2/3
  22.         0,                    -> Screen link.
  23.         palette,              -> Address of palette.
  24.         0,                    -> Address of rasterlist.
  25.         16,                   -> Amt of colours in palette.
  26.         320,256,640,256,      -> Screen & Pic Height/Width
  27.         4,                    -> Amt of planes.
  28.         0,0,                  -> Top of screen offsets, X/Y
  29.         0,0,                  -> X/Y counters (for scrolling).
  30.         HSCROLL,              -> Special attributes.
  31.         LORES,                -> Screen mode.
  32.         INTERLEAVED,          -> Screen type
  33.         0                     -> Reserved area.               
  34.           ]:gamescreen;    
  35.  
  36.    loadpic := [    PCV1,0,             -> Version header.
  37.         0,                  -> Destination.
  38.         640,256,            -> Width, Height.
  39.         4,                  -> Amount of Planes.
  40.         16,                 -> Amount of colours.
  41.         palette,            -> Palette (remap).
  42.         LORES,              -> Screen mode.
  43.         INTERLEAVED,        -> Destination.
  44.         0                   -> Parameters.
  45.               ]:picture;
  46.  
  47.    IF gmsbase := OpenLibrary('games.library',0)
  48.       SetUserPri()
  49.       IF (Add_Screen(screen) = ERR_OK)
  50.          loadpic.data := screen.memptr1;
  51.          IF (LoadPic('GAMESLIB:data/IFF.Pic640x256',loadpic) = ERR_OK)
  52.             Show_Screen(screen)
  53.         REPEAT
  54.           Wait_OSVBL()
  55.           IF (screen.picxoffset = 320) THEN direction := -1
  56.           IF (screen.picxoffset = 0) THEN direction := 1
  57.           screen.picxoffset := screen.picxoffset+direction
  58.           Move_Picture(screen)
  59.         UNTIL !(Read_Mouse(JPORT1) AND MB_LMB)
  60.           ENDIF
  61.     Delete_Screen(screen)        
  62.       ENDIF
  63.    CloseLibrary(gmsbase)
  64.    ENDIF
  65. ENDPROC
  66.